#pragma once

#include <stdio.h>


class MyView : public sigslot::SigSlotBase
{
public:
	sigslot::Signal<int> ClickedButton;

public:
	void OnListDataChanged(int index)
	{
		ConsoleLog(_T("OnListDataChanged : index = %d\n"), index);

		ClickedButton(index);
	}
};



class MyModel : public sigslot::SigSlotBase
{
public:
	sigslot::Signal<int> DataChangedAt;

public:
	void OnSelectIndexChanged(int index)
	{
		ConsoleLog(_T("OnSelectIndexChanged: index=%d\n"), index);
	}

	void Run()
	{
		m_View = new MyView();

		DataChangedAt.connect(m_View, &MyView::OnListDataChanged);

		m_View->ClickedButton.connect(this, &MyModel::OnSelectIndexChanged);

		while (true)
		{
			static int index = 0;
			index++;

			DataChangedAt(index);
			Sleep(500);
		}

	}

private:
	MyView* m_View;
};


void TestSignalSlot()
{
	MyModel model;
	
	model.Run();


}